home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / INTERVIE / FONT.H < prev    next >
C/C++ Source or Header  |  1992-03-11  |  3KB  |  91 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. /*
  24.  * Text drawing fonts
  25.  */
  26.  
  27. #ifndef font_h
  28. #define font_h
  29.  
  30. const int FONTSTRINGSIZE = 85;
  31.  
  32. #include <InterViews/resource.h>
  33. #include <windows.h>
  34.  
  35. class Font : public Resource {
  36. public:
  37.     Font(const char*);
  38.     Font(const char*, int);
  39.     ~Font();
  40.  
  41.     int Baseline();
  42.     boolean FixedWidth();
  43.     int Height();
  44.     int Index(const char*, int offset, boolean between);
  45.     int Index(const char*, int, int offset, boolean between);
  46.     boolean Valid();
  47.     int Width(const char*);
  48.     int Width(const char*, int);
  49.     void* Id();
  50.     char* Name();
  51. private:
  52.     friend class Painter;
  53.     friend class BitmapRep;
  54.  
  55.     class FontRep* rep;
  56.  
  57.     void GetFontByName(const char*);
  58.     boolean Lookup(const char*, int);
  59. };
  60.  
  61. class FontRep : public Resource {
  62. private:
  63.     friend class Font;
  64.     friend class Painter;
  65.  
  66.     FontRep();
  67.     ~FontRep();
  68.     void MakeNewFont(const char*);
  69.  
  70.     void* id;
  71.     char name[FONTSTRINGSIZE];
  72.     char typeface[30];
  73.     int height;
  74.  
  75.     boolean       IsStockFont(const char*);
  76.     void          GetFontString(char**);
  77.     boolean       GetFontResource(char**);
  78.     void          GetFontAlias(const char*);
  79.  
  80.     boolean       GetLogFont(void*);
  81.     void          GetLogFontTypeFace(char*);
  82.     unsigned char GetLogFontCharSet();
  83. };
  84.  
  85. inline char*     Font::Name()         { return rep->name; };
  86. inline void*     Font::Id()         { return (void*)rep->id; };
  87.  
  88. extern Font* stdfont;
  89.  
  90. #endif
  91.